<html>
<head><meta charset="utf-8"><title>Diagnostic Item Naming Convention? · t-compiler/wg-diagnostics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/index.html">t-compiler/wg-diagnostics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html">Diagnostic Item Naming Convention?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224964313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/224964313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#224964313">(Feb 03 2021 at 01:55)</a>:</h4>
<p>I'm looking into migrating Clippy code to use more diagnostic items. But there seems to be a conflict in naming. Sometimes names are camel case like <code>hashmap_type</code> and sometimes they match the item name exactly like <code>IntoIterator</code>. I really like the latter for readability. Is there a reason for camel case? Can we agree on a convention?</p>



<a name="225024603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/225024603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#225024603">(Feb 03 2021 at 14:44)</a>:</h4>
<p>Also, using the exact name gives us more mileage out of <code>sym::*</code> items.</p>
<p>For more specific items like <code>Iterator::map</code>, I imagine we could name it <code>iterator_map</code>, but perhaps we could name it <code>Iterator::map</code>. Yet another approach is to avoid diagnostic items on associated items and instead write code like <code>is_diagnostic_assoc_item(did, sym::Iterator, sym::map)</code>.</p>



<a name="225024792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/225024792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#225024792">(Feb 03 2021 at 14:46)</a>:</h4>
<p>CC <span class="user-group-mention" data-user-group-id="3456">@T-clippy</span></p>



<a name="225025241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/225025241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#225025241">(Feb 03 2021 at 14:49)</a>:</h4>
<p>having a way to check for assoc items of diagnostic items sounds like a much more scalable approach than attaching diagnostic item information to all things. It may be a bit more expensive, but likely that perf diff is irrelevant</p>



<a name="225025470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/225025470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#225025470">(Feb 03 2021 at 14:50)</a>:</h4>
<p>I agree. Shouldn't be too bad if we use <code>AssociatedItems::find_by_name_and_kind</code>.</p>



<a name="246137929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246137929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246137929">(Jul 15 2021 at 18:43)</a>:</h4>
<p>Hey, I've basically reached the same point where I want to move more of Clippy's code to use diagnostic items. Has there been any progress on implementing  a function like <code>is_diagnostic_assoc_item(did, sym::Iterator, sym::map)</code>? If not, I would be happy to pick that up <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="246211401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246211401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246211401">(Jul 16 2021 at 11:30)</a>:</h4>
<p>There has been zero progress</p>



<a name="246211464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246211464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246211464">(Jul 16 2021 at 11:30)</a>:</h4>
<p>I believe you can prototype this in clippy's util module instead of in rustc, which should make it easier and faster to develop</p>



<a name="246215372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246215372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246215372">(Jul 16 2021 at 12:18)</a>:</h4>
<p><span class="user-mention" data-user-id="369415">@xFrednet</span> we have is_diag_trait_item and is_diag_item_method in clippy_utils</p>



<a name="246218102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246218102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246218102">(Jul 16 2021 at 12:49)</a>:</h4>
<p>Oh, I've missed that, thank you for the reference, that should eliminate some more paths <span aria-label="gun" class="emoji emoji-1f52b" role="img" title="gun">:gun:</span></p>



<a name="246219134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246219134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246219134">(Jul 16 2021 at 12:59)</a>:</h4>
<p>Yeah it's too many disjoint utils</p>



<a name="246219629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246219629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246219629">(Jul 16 2021 at 13:03)</a>:</h4>
<p>we could move these helpers to rustc, right next to <code>is_diagnostic_item</code>, so it is more discoverable</p>



<a name="246219691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246219691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246219691">(Jul 16 2021 at 13:04)</a>:</h4>
<p>(and probably make these functions mention each other in the docs)</p>



<a name="246220590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246220590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246220590">(Jul 16 2021 at 13:13)</a>:</h4>
<p>I'm looking to replace them though</p>



<a name="246220614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic%20Item%20Naming%20Convention%3F/near/246220614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F.html#246220614">(Jul 16 2021 at 13:13)</a>:</h4>
<p>But I should stop talking and PR :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>